﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            Bird bird = new Bird("喜鹊");
            A(bird);
            I(bird);
            bird.Yumao();
            Console.WriteLine("---------");
            Plane plane = new Plane("急先锋");
            plane.Goju();
            I(plane);
            Console.WriteLine("---------");
            Superman superman = new Superman("超人强");
            A(superman);
            I(superman);
            Console.ReadKey();
        }
        public static void A(Animal A) 
        {
            A.Eat();
        }
        public static void I(IFlyable I) 
        {
            I.TakeOff();
            I.Fly();
            I.Land();
        }
    }
    class Bird : Animal, IFlyable
    {
        public string Name { get; set; }
        public Bird(string name) 
        {
            this.Name = name;
        }
        public void Yumao() 
        {
            Console.WriteLine(this.Name+"有美丽的羽毛。");
        }
        public override void Eat()
        {
            Console.WriteLine(this.Name+"可以吃虫子。");
        }

        public void Fly()
        {
            Console.WriteLine(this.Name+"在飞翔");
        }

        public void Land()
        {
            Console.WriteLine(this.Name+"在降落");
        }

        public void TakeOff()
        {
            Console.WriteLine(this.Name + "在起飞");
        }
    }
    class Plane :Vehicle,IFlyable
    {
        public string Name { get; set; }
        public Plane(string name)
        {
            this.Name = name;
        }
        public override void Goju()
        {
            base.Goju();
            Console.WriteLine(this.Name+"是一个交通工具。");
        }
        public void TakeOff()
        {
            Console.WriteLine(this.Name + "在起飞");
        }

        public void Fly()
        {
            Console.WriteLine(this.Name + "在飞翔");
        }

        public void Land()
        {
            Console.WriteLine(this.Name + "在降落");
        }
    }
    class Superman :Animal,IFlyable
    {
        public string Name { get; set; }
        public Superman(string name)
        {
            this.Name = name;
        }
        public void Cnl()
        {
            Console.WriteLine(this.Name + "有超能力。");
        }
        public override void Eat()
        {
            Console.WriteLine(this.Name + "可以吃很多饭。");
        }

        public void Fly()
        {
            Console.WriteLine(this.Name + "在飞翔");
        }

        public void Land()
        {
            Console.WriteLine(this.Name + "在降落");
        }

        public void TakeOff()
        {
            Console.WriteLine(this.Name + "在起飞");
        }
    }
    interface IFlyable
    {
        void TakeOff();
        void Fly();
        void Land();
    }
    abstract class Animal 
    {
        public abstract void Eat();
    }
    class Vehicle 
    {
        public virtual void Goju() { }
    }
}
